<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let p1 = new Promise(function(resolve,reject){
            console.log("开始执行");
            setTimeout(()=>{
                console.log('执行成功回调');
                resolve()
            },Math.random()*100);

            setTimeout(()=>{
                console.log('执行失败回调');
                reject()
            },Math.random()*100);
        });
        p1.then((res)=>{
            console.log(res);
        })
        p1.catch((err)=>{
            console.log(err);
        })


    </script>
    
</body>
</html>